package com.wjb.controller;

import com.wjb.pojo.Emun.OrderStatus;
import com.wjb.pojo.dto.OrderxDto;
import com.wjb.service.ItemStockService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.sql.Connection;

/**
 * @author : 王济彬
 * @date: 2025/5/24 - 05 - 24 - 15:27
 * @Description: com.wjb.controller
 * @version: 1.0
 */
@RestController
@RequestMapping("/itemstock")
public class ItemStockController {

    @Resource
    private ItemStockService itemStockService;

    @GetMapping("/test/creatOrder")
    public String testCreateOrder() {
        OrderxDto request = new OrderxDto(
                "orderId",
                "orderName",
                7,
                1,
                OrderStatus.PENDING_PAYMENT.getDescription()
        );
        return itemStockService.createOrder(request);
    }

    @PostMapping("/createOrder")
    public String createOrder(@RequestBody OrderxDto request) {
        return itemStockService.createOrder(request);
    }

}
